home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
usr
/
bin
/
select-editor
< prev
next >
Wrap
Text File
|
2008-09-03
|
1KB
|
46 lines
#!/bin/sh
# To generate localization information, run:
# xgettext -o - -L Shell select-editor
# Ensure that $HOME/.selected_editor is writeable
touch $HOME/.selected_editor || exit 1
editors=`update-alternatives --list editor | wc -l`
if [ $editors -gt 1 ]; then
echo "`gettext '\nSelect an editor. To change later, run'`" "'select-editor'."
i=0
editors=`update-alternatives --list editor`
for e in $editors; do
i=`expr $i + 1`
desc=" "
if [ $e = "/bin/nano" ]; then
desc="<---- ` gettext 'easiest'`"
simple=$i
fi
echo " $i. $e\t\t$desc"
done
echo ""
selected=x
while /bin/true; do
if [ -z "$selected" -a ! -z "$simple" ]; then
selected="$simple"
elif ! test $selected -gt 0 2>/dev/null; then
read -p "`gettext 'Choose'` 1-$i [$simple]: " -r selected
elif ! test $selected -le $i 2>/dev/null; then
read -p "`gettext 'Choose'` 1-$i [$simple]: " -r selected
else
break
fi
done
i=0
for e in $editors; do
i=`expr $i + 1`
if [ $i -eq $selected ]; then
echo "# Generated by /usr/bin/select-editor" > $HOME/.selected_editor
echo "SELECTED_EDITOR=\"$e\"" >> $HOME/.selected_editor && exit 0
fi
done
fi
exit 1